package com.zhaosc.elasticsearch;

import java.io.IOException;

import org.apache.http.HttpHost;
import org.apache.log4j.Logger;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.junit.After;
import org.junit.Before;

public class BaseTest {
	
	RestHighLevelClient client = null;

	 String index = "test";
	 
     String movies="movies";
     
     String products="products";

	private static final Logger logger = Logger.getLogger(BaseTest.class);

	@Before
	public void init() {
		client = new RestHighLevelClient(RestClient.builder(new HttpHost("47.95.7.17", 9200, "http")));
		logger.info("*****初始化*****");

	}
	
	@After
	public void close() {
		try {
			if (client != null) {
				client.close();
				logger.info("*****关闭*****");
			}
		} catch (IOException e) {
			logger.error(e);
		}

	}

}
